package com.lesama.stream;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;

// 图片加密解密

public class ImageTest {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("D:\\xiangzi.jpg");
        ArrayList<Integer> list = new ArrayList<>();
        int i;
        while((i = fis.read()) != -1) {
            list.add(i);
        }
        fis.close();

        FileOutputStream fos = new FileOutputStream("D:\\xiangzi.jpg");
        for (Integer integer : list) {
            fos.write(integer ^ 2);
        }
        fos.close();
    }
}
